package commons.base.netty;

/**
 * 空闲超时配置
 * @author yuan<cihang.yuan@happyelements.com>
 *
 */
public class IdleTimeoutConfig {

	/**
	 * 如果空闲超时,是否做一些操作. 比如: 心跳, 关闭通道等
	 */
	private boolean isIdleTimeoutOp = false;
	/**
	 * 读空闲时间,单位秒. 0表示忽略
	 */
	private int readerIdleTimeSeconds = 0;
	/**
	 * 写空闲时间,单位秒. 0表示忽略
	 */
	private int writerIdleTimeSeconds = 0;
	/**
	 * 读写都空闲时间,单位秒. 0表示忽略
	 */
	private int allIdleTimeSeconds = 0;
	/**
	 * 通道空闲超时监听器
	 */
	private ChannelIdleTimeoutListener channelIdleTimeoutListener;
	
	public IdleTimeoutConfig(){
		
	}
	
	public IdleTimeoutConfig(ChannelIdleTimeoutListener channelIdleTimeoutListener) {
		this.channelIdleTimeoutListener = channelIdleTimeoutListener;
	}

	public IdleTimeoutConfig(boolean isIdleTimeoutOp, int readerIdleTimeSeconds, int writerIdleTimeSeconds,
			int allIdleTimeSeconds, ChannelIdleTimeoutListener channelIdleTimeoutListener) {
		this.isIdleTimeoutOp = isIdleTimeoutOp;
		this.readerIdleTimeSeconds = readerIdleTimeSeconds;
		this.writerIdleTimeSeconds = writerIdleTimeSeconds;
		this.allIdleTimeSeconds = allIdleTimeSeconds;
		this.channelIdleTimeoutListener = channelIdleTimeoutListener;
	}
	
	public boolean isIdleTimeoutOp() {
		return isIdleTimeoutOp;
	}
	public void setIdleTimeoutOp(boolean isIdleTimeoutOp) {
		this.isIdleTimeoutOp = isIdleTimeoutOp;
	}
	public int getReaderIdleTimeSeconds() {
		return readerIdleTimeSeconds;
	}
	public void setReaderIdleTimeSeconds(int readerIdleTimeSeconds) {
		this.readerIdleTimeSeconds = readerIdleTimeSeconds;
	}
	public int getWriterIdleTimeSeconds() {
		return writerIdleTimeSeconds;
	}
	public void setWriterIdleTimeSeconds(int writerIdleTimeSeconds) {
		this.writerIdleTimeSeconds = writerIdleTimeSeconds;
	}
	public int getAllIdleTimeSeconds() {
		return allIdleTimeSeconds;
	}
	public void setAllIdleTimeSeconds(int allIdleTimeSeconds) {
		this.allIdleTimeSeconds = allIdleTimeSeconds;
	}

	public ChannelIdleTimeoutListener getChannelIdleTimeoutListener() {
		return channelIdleTimeoutListener;
	}

	public void setChannelIdleTimeoutListener(
			ChannelIdleTimeoutListener channelIdleTimeoutListener) {
		this.channelIdleTimeoutListener = channelIdleTimeoutListener;
	}
	
}
